﻿using STMS.Models.DModels;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace STMS.DAL
{
    public class UserDAL:BaseDAL<UserInfo>
    {
        /// <summary>
        /// 用户登录，返回用户Id
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
         public UserInfo Login(UserInfo userInfo)
        {
            if (userInfo == null)
                throw new Exception("没有初始化登录信息！");
            string strWhere = "UserName=@userName and UserPwd=@userPwd and UserState=1 and IsDeleted=0";
            SqlParameter[] paras =
            {
                new SqlParameter("@userName",userInfo.UserName),
                new SqlParameter("@userPwd",userInfo.USerPwd)
            };
           UserInfo reUser = GetModel(strWhere, "UserId", paras);
            return reUser;
        }
    }
}
